package cn.myzqu.sign.user.server.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
 * @Author: 的川 @Date: 2019/1/21.
 */
@Data
public class UserPublicVo {


    private Integer id;

    private String code;

    private String realName;

    private String nickName;

    private String icon;

    private String gender;

    private Date birth;

    private String label;

    private String brief;

    private String phone;

    private String email;

    private String qq;

    private String wechat;

    private String openId;

    private Byte type;

    private Integer rank;

    private String registerBy;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date registerTime;


    public void setGender(Byte gender) {
        //性别，1为男性，0为女性，-1为未知
        //gender可能为null，如果不判空，直接 == 0 ，则会报错
        if(gender == null){
            this.gender = "未知";
        } else if(gender == 0){
            this.gender = "女";
        }else if(gender == 1){
            this.gender = "男";
        }else{
            this.gender = "未知";
        }

    }
}
